﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="setPromotion.aspx.cs" Inherits="EWDTAssignment.setPromotion" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table style="width:100%;">
        <tr>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                <asp:ScriptManager ID="ScriptManager1" runat="server">
                </asp:ScriptManager>
            </td>
        </tr>
        <tr>
            <td>
                Product Category:</td>
            <td rowspan="3">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <table style="width:100%;">
                            <tr>
                                <td>
                                    <asp:DropDownList ID="PromotionProCategoryDDL" runat="server" 
                                        AutoPostBack="True" Height="16px" 
                                        onselectedindexchanged="PromotionProCategoryDDL_SelectedIndexChanged" 
                                        Width="205px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:DropDownList ID="PromotionProIdDDL" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="PromotionProIdDDL_SelectedIndexChanged" Width="205px">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:TextBox ID="PromotionProIDTbx" runat="server" AutoPostBack="True" 
                                        ReadOnly="True" Width="205px"></asp:TextBox>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Product Name:</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                Product ID:</td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                    ControlToValidate="PromotionProIDTbx" Display="Dynamic" 
                    ErrorMessage="*Please select Product" ValidationGroup="Promotion"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                DiscountRate:</td>
            <td>
                <asp:TextBox ID="PromotionDiscountRateTbx" runat="server" 
                    ValidationGroup="To set discount rate, from 0 to 1" Width="205px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                    ControlToValidate="PromotionDiscountRateTbx" Display="Dynamic" 
                    ErrorMessage="*Discount Is Required" ValidationGroup="Promotion"></asp:RequiredFieldValidator>
                <asp:RangeValidator ID="RangeValidator1" runat="server" 
                    ControlToValidate="PromotionDiscountRateTbx" Display="Dynamic" 
                    ErrorMessage="Discount is from 0.0 to 1.0" MaximumValue="1" MinimumValue="0" 
                    Type="Double" ValidationGroup="Promotion"></asp:RangeValidator>
            </td>
        </tr>
        <tr>
            <td>
                Start TIme:</td>
            <td>
                <asp:TextBox ID="PromotionStartTimeTbx" runat="server" Width="205px"></asp:TextBox>
                <asp:CalendarExtender ID="PromotionStartTimeTbx_CalendarExtender" 
                    runat="server" Format="yyyy/MM/dd" Enabled="True" TargetControlID="PromotionStartTimeTbx">
                </asp:CalendarExtender>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                    ControlToValidate="PromotionStartTimeTbx" ErrorMessage="Start Day is required"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                End Time:</td>
            <td>
                <asp:TextBox ID="PromotionEndTimeTbx" runat="server" Width="205px"></asp:TextBox>
                <asp:CalendarExtender ID="PromotionEndTimeTbx_CalendarExtender" runat="server" 
                    Enabled="True" Format="yyyy/MM/dd" TargetControlID="PromotionEndTimeTbx">
                </asp:CalendarExtender>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                    ControlToValidate="PromotionEndTimeTbx" Display="Dynamic" 
                    ErrorMessage="End Day is required"></asp:RequiredFieldValidator>
                <asp:CompareValidator ID="CompareValidator1" runat="server" 
                    ControlToCompare="PromotionStartTimeTbx" 
                    ControlToValidate="PromotionEndTimeTbx" 
                    ErrorMessage="End Time should be after Start Time" Operator="GreaterThan"></asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td>
                Promotion Image:</td>
            <td>
                <asp:FileUpload ID="PromotionImgUpload" runat="server" Width="226px" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                &nbsp;</td>
            <td>
                <asp:Button ID="PromotionSaveBtn" runat="server" 
                    onclick="PromotionSaveBtn_Click" Text="Submit" ValidationGroup="Promotion" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
</asp:Content>
